﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace WcMatch.Migrations.College
{
    /// <inheritdoc />
    public partial class update20230501 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_T_User_College",
                table: "T_User_College");

            migrationBuilder.RenameColumn(
                name: "Token",
                table: "T_User_College",
                newName: "UName");

            migrationBuilder.AlterColumn<string>(
                name: "Uid",
                table: "T_User_College",
                type: "varchar(255)",
                nullable: false,
                collation: "utf8_general_ci",
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8")
                .OldAnnotation("MySql:CharSet", "utf8")
                .OldAnnotation("Relational:Collation", "utf8_general_ci");

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "T_User_College",
                type: "longtext",
                nullable: true,
                collation: "utf8_general_ci",
                oldClrType: typeof(string),
                oldType: "longtext")
                .Annotation("MySql:CharSet", "utf8")
                .OldAnnotation("MySql:CharSet", "utf8")
                .OldAnnotation("Relational:Collation", "utf8_general_ci");

            migrationBuilder.AlterColumn<string>(
                name: "CollegeId",
                table: "T_User_College",
                type: "varchar(200)",
                maxLength: 200,
                nullable: true,
                collation: "utf8_general_ci",
                oldClrType: typeof(string),
                oldType: "varchar(200)",
                oldMaxLength: 200)
                .Annotation("MySql:CharSet", "utf8")
                .OldAnnotation("MySql:CharSet", "utf8")
                .OldAnnotation("Relational:Collation", "utf8_general_ci");

            migrationBuilder.AddPrimaryKey(
                name: "PK_T_User_College",
                table: "T_User_College",
                column: "Uid");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_T_User_College",
                table: "T_User_College");

            migrationBuilder.RenameColumn(
                name: "UName",
                table: "T_User_College",
                newName: "Token");

            migrationBuilder.UpdateData(
                table: "T_User_College",
                keyColumn: "Name",
                keyValue: null,
                column: "Name",
                value: "");

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "T_User_College",
                type: "longtext",
                nullable: false,
                collation: "utf8_general_ci",
                oldClrType: typeof(string),
                oldType: "longtext",
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8")
                .OldAnnotation("MySql:CharSet", "utf8")
                .OldAnnotation("Relational:Collation", "utf8_general_ci");

            migrationBuilder.UpdateData(
                table: "T_User_College",
                keyColumn: "CollegeId",
                keyValue: null,
                column: "CollegeId",
                value: "");

            migrationBuilder.AlterColumn<string>(
                name: "CollegeId",
                table: "T_User_College",
                type: "varchar(200)",
                maxLength: 200,
                nullable: false,
                collation: "utf8_general_ci",
                oldClrType: typeof(string),
                oldType: "varchar(200)",
                oldMaxLength: 200,
                oldNullable: true)
                .Annotation("MySql:CharSet", "utf8")
                .OldAnnotation("MySql:CharSet", "utf8")
                .OldAnnotation("Relational:Collation", "utf8_general_ci");

            migrationBuilder.AlterColumn<string>(
                name: "Uid",
                table: "T_User_College",
                type: "longtext",
                nullable: false,
                collation: "utf8_general_ci",
                oldClrType: typeof(string),
                oldType: "varchar(255)")
                .Annotation("MySql:CharSet", "utf8")
                .OldAnnotation("MySql:CharSet", "utf8")
                .OldAnnotation("Relational:Collation", "utf8_general_ci");

            migrationBuilder.AddPrimaryKey(
                name: "PK_T_User_College",
                table: "T_User_College",
                column: "CollegeId");
        }
    }
}
